import BaseFindApi from '@/api/baseFindApi';
import {ID, PARAMS} from '@/api/http';
import SetTagRequest from '../structure/setTagRequest';
import WxUser from '../structure/wxUser';

/**
 * 微信用户
 */
class WxUserApi extends BaseFindApi<WxUser> {
    public getBase(): string {
        return 'wx/user/wxUser';
    }

    /**
     * 删除用户
     * @param appId 应用ID
     * @param openId 用户ID
     * @return 响应
     */
    public delete(appId: ID, openId: ID): Promise<void> {
        return super.delete0(`${this.getBase()}/${appId}/${openId}`);
    }

    /**
     * 设置标签
     * @param openId openId
     * @param data 请求数据
     * @return 响应
     */
    public setTags(openId: string, data: SetTagRequest): Promise<void> {
        return super.post0(`${this.getBase()}/${openId}/setTags`, data);
    }

    /**
     * 批量设置标签
     * @param data 请求数据
     * @return 响应
     */
    public batchSetTags(data: SetTagRequest): Promise<void> {
        return super.post0(`${this.getBase()}/batchSetTags`, data);
    }

    /**
     * 导出excel
     * @param params 参数
     * @return 响应
     */
    public exportExcel(params: PARAMS): Promise<Blob> {
        return super.get0(`${this.getBase()}/exportExcel`, {
            responseType: 'blob',
            params
        });
    }

}

export default new WxUserApi();
